#ifndef FGE_FONT_HPP
#define FGE_FONT_HPP

#include <string>
#include <stdint.h>
#include <map>

#include "Math.hpp"

namespace fge
{

class Color;
class SpriteBatch;

struct CharacterData
{
	int16_t offsetX, offsetY;
	int16_t advanceX, advanceY;
	uint16_t width, height;
	float u1, v1, u2, v2;
};

class Font
{
public:
	~Font();

	static Font *FromFile(const std::string &filename);

	Vector2 MeasureString(const std::string &s);

	void DrawString(const std::string& s, const Vector2 &position, const Color &color);

	unsigned int GetTextureId() const { return textureId; }
	unsigned int GetHeight() const { return height; }

	CharacterData& GetCharacterData(uint16_t character)
	{
		if(characters.count(character) == 1)
			return characters[character];
		return characters[' '];
	}

protected:
	Font()
		: textureId(0)
	{
	}

	int height;
	unsigned int textureId;
	std::map<uint16_t, CharacterData> characters;
};

}

#endif//FGE_FONT_HPP

